<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
    <%@taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<jsp:include page="/common/commonCss.jsp" />
<jsp:include page="/common/commonJs.jsp" />
<title>嘉童游乐中心-审核库存调整</title>
<script type="text/javascript">
	$(document).ready(function(){
		 //获得上次保存的调整商品
		getSavedBeans();
		 
	});
	
	function getSavedBeans()
	{
		 $.ajax({
				url:"${basePath}StockCorrect/getSavedCorrectPrds.shtml",
				data:{"fkStgadjId":"${scmStgAdj['pkStgadjId']}","fkBranId":"${scmStgAdj['fkBranId']}"},
				dataType:"json",
				type:"post",
				async:false,
				success:function(result)
				{
					initCorrectTable(result);
				},
				error : function(XMLHttpRequest) {
					ajaxError(XMLHttpRequest);
				}
			});
		 function initCorrectTable(data) {
				if(data == null)
					{
					return;
					}
				trimJsonArray(data); 
				html = "";
				$.each(data, function(ind, obj)
				{
					var num = (obj.stgCnt == "" ? 0 : obj.stgCnt);
					html += "<tr><td>" + (parseInt(1) + ind) + "</td>";
					html += "<td>" + obj.pkPrdId + "</td>";
					html += "<td>" + obj.prdName + "</td>";
					html += "<td>" + obj.cateName + "</td>";
					html += "<td>" + obj.prdSpec + "</td>";
					html += "<td>" + obj.unitName + "</td>";
					html += "<td>" + obj.stkCnt + "</td>";
					html += "<td>" + num + "</td>";
					html += "<td>"+obj.adjCnt+"</td>";
					html += "<td>"+obj.comments+"</td></tr>";
					});
				$("#tbody").html(html);
			}
	}
</script>
</head>
<body class="bg">
<div class="content m_auto">
	<div class="content_l mt10">
    	<ul>
    	 <shiro:hasPermission name="StockGoodsIn/toStock_goodsIn.shtml">
       		<li><a href="${basePath}StockGoodsIn/toStock_goodsIn.shtml"><i class="nav_icon_b"></i><br>商品入库</a></li>
			</shiro:hasPermission>
		<shiro:hasPermission name="StockQuery/toStockQuery.shtml">
			<li><a href="${basePath}StockQuery/toStockQuery.shtml"><i class="nav_icon_b"></i><br>库存查询</a></li>
			</shiro:hasPermission>
		<shiro:hasPermission name="StockGoodsOut/toStockGoodsOut.shtml">
			<li><a href="${basePath}StockGoodsOut/toStockGoodsOut.shtml"><i class="nav_icon_b"></i><br>商品出库</a></li>
			</shiro:hasPermission>
		<shiro:hasPermission name="StockTaking/toStockTaking.shtml">
			<li><a href="${basePath}StockTaking/toStockTaking.shtml"><i class="nav_icon_a"></i><br>库存盘点</a></li>
            </shiro:hasPermission>
		<shiro:hasPermission name="StockCorrect/toStockCorrect.shtml">
            <li class="content_hover"><a href="${basePath}StockCorrect/toStockCorrect.shtml"><i class="nav_icon_f"></i><br>库存调整</a></li>
        </shiro:hasPermission>
        </ul>
    </div>
    <div class="content_r mt10">
    	<div class="p20">
    	<div class="file_single_dl f14 fixed">
       		 <dl class="fixed"  >
                <dd ><label> 库存调整申请编号：</label>${scmStgAdj['pkStgadjId']}</dd>
                <dd><label>创建人：</label>${scmStgAdj['usrName']}</dd>
                <dd><label>创建时间：</label>${applyTime}</dd>
           		 </dl>
        	 </div>
		         <div id="scrollTable" style="width:1120px; height: 263px;">
		            <table class="table">
		          	    <col width="80px"></col>
		                <col width="130px"></col>
		                <col width="130px"></col>
		                <col width="130px"></col>
		                <col width="80px"></col>
		                <col width="80px"></col>
		                <col width="120px"></col>
		                <col width="130px"></col>
		                <col width="120px"></col>
		                <col></col>
		                <tbody>
		                 	<tr>
		                    	<th>序号</th>
		                        <th>商品编号</th>
		                        <th>商品名称</th>
		                        <th>商品分类</th>
		                        <th>规格</th>
		                        <th>单位</th>
		                        <th>盘点实际数量</th> 
		                        <th>商品实际库存数量</th> 
		                        <th>调整数量</th> 
		                        <th>调整原因</th> 
		                     </tr>
		                     </tbody>
		                  </table>
		              <div>
		            <table class="table" id="selectProduct" >
						<col width="80px"></col>
		                <col width="130px"></col>
		                <col width="130px"></col>
		                <col width="130px"></col>
		                <col width="80px"></col>
		                <col width="80px"></col>
		                <col width="120px"></col>
		                <col width="130px"></col>
		                <col width="120px"></col>
		                <col></col>
		                <tbody id="tbody">
		                  
		                </tbody>
		            </table>
		            </div>
		        </div>
                   <dl class="fixed order_dl">
                      <dd><label><b>当前状态：</b></label>
                       	 ${statusDesc}
                     </dd>
                 	<dd><label><b>处理历史：</b></label>
                     <dd>
                         <table class="table">
                             <tr>
                                 <th>时间</th>
                                 <th>处理人</th>
                                 <th>结果</th>
                                 <th>处理意见</th>
                             </tr>
                             <c:forEach items="${scmStgAdj.workflowVo.optHisVoList }" var="his">
								<tr>
								<td style="width: 40%">${his.optTime }</td>
								<td>${his.optName }</td>
								<td>${his.result }</td>
								<td title="${his.advice}">
								<c:if test="${his.advice != null}">
									<c:choose>
										<c:when test="${his.advice.length() > 5}">
											${his.advice.substring(0,5)}...
										</c:when>
										<c:otherwise>
											${his.advice}
										</c:otherwise>
									</c:choose>
								</c:if>
								</td>
							</tr>
							</c:forEach>
                         </table>
                     </dd>
           	 </dl>
                    <div class="btm_btn mt10">
                            <dl>
                                <dd><input class="btn" type="button" value="返回" onClick="javascript:history.go(-1);"></dd>
                            </dl>
                    </div>
                    </div>
        </div>
        </div>
</body>
</html>